const router = require("koa-router")();
const Mock = require("mockjs");
const Random = Mock.Random;
const fs = require('fs');
const path = require('path');
const sleep = (timer) => {
  return new Promise((resolve, reject) => {
    const ter = setTimeout(() => {
      clearTimeout(ter);
      resolve();
    }, timer);
  });
};

const msg = {
  code: 200,
  message: "成功",
};

// 登录
router.get("/carbon/api/user/login", async (ctx, next) => {
  await sleep(2000);
  ctx.body = {
    ...msg,
    data: {
      user_info: {
        id: 123,
        account: "admin",
        user_name: "管理员",
        phone: "13000000000",
        status: 0,
      },
    },
    jwt_token:
      "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiYWNjb3VudCI6ImFkbWluIiwidXNlcl9uYW1lIjoiXHU3YmExXHU3NDA2XHU1NDU4IiwicGhvbmUiOiIxMzAwMDAwMDAwMCIsInN0YXR1cyI6MCwiZXhwIjoxNzI5Njk0MjYwfQ.RRI27wIWfnDNVWEchZ7aB98FDJp8bSHDJHgDFpgXeLI",
  };
});

// 注册
router.get("/carbon/api/user/register", async (ctx, next) => {
  await sleep(2000);
  ctx.body = {
    ...msg,
    data: {
      user_info: {
        id: 123,
        account: "admin",
        user_name: "管理员",
        phone: "13000000000",
        status: 0,
      },
    },
  };
});

// 登出
router.get("/carbon/api/user/logout", (ctx, next) => {
  ctx.body = msg;
});

// 获取用户信息
router.all("/carbon/api/user/user_info", (ctx, next) => {
  ctx.body = {
    ...msg,
    data: {
      user_info: {
        id: 123,
        account: "admin",
        user_name: "管理员",
        phone: "13000000000",
        status: 0,
      },
    },
  };
});

// 获取上传文件列表
router.get("/carbon/api/file/list", async (ctx, next) => {
  await sleep(1000);
  const type = ["柱状图", "折线图", "散点图", "饼图", "热力图", "地图热力图"];
  const geoData = [
    {
      name: "北京市",
      value: 10,
    },
    {
      name: "上海市",
      value: 20,
    }, // 示例值
    {
      name: "天津市",
      value: 30,
    }, // 示例值
    {
      name: "重庆市",
      value: 40,
    }, // 示例值
    {
      name: "河北省",
      value: 55,
    }, // 示例值
    {
      name: "山西省",
      value: 12,
    }, // 示例值
    {
      name: "辽宁省",
      value: 56,
    }, // 示例值
    {
      name: "吉林省",
      value: 23,
    }, // 示例值
    {
      name: "黑龙江省",
      value: 90,
    }, // 示例值
    {
      name: "江苏省",
      value: 12,
    }, // 示例值
    {
      name: "浙江省",
      value: 23,
    }, // 示例值
    {
      name: "安徽省",
      value: 100,
    }, // 示例值
    {
      name: "福建省",
      value: 12,
    }, // 示例值
    {
      name: "江西省",
      value: 68,
    }, // 示例值
    {
      name: "山东省",
      value: 2,
    }, // 示例值
    {
      name: "河南省",
      value: 23,
    }, // 示例值
    {
      name: "湖北省",
      value: 100,
    }, // 示例值
    {
      name: "湖南省",
      value: 82,
    }, // 示例值
    {
      name: "广东省",
      value: 11,
    }, // 示例值
    {
      name: "海南省",
      value: 12,
    }, // 示例值
    {
      name: "四川省",
      value: 34,
    }, // 示例值
    {
      name: "贵州省",
      value: 56,
    }, // 示例值
    // {
    //   name: "云南省",
    //   value: 60,
    // }, // 示例值
    // {
    //   name: "陕西省",
    //   value: 10,
    // }, // 示例值
    {
      name: "甘肃省",
      value: 1,
    }, // 示例值
    {
      name: "青海省",
      value: 34,
    }, // 示例值
    {
      name: "台湾省",
      value: 46,
    }, // 示例值（包括金门、马祖等岛屿）
    {
      name: "内蒙古自治区",
      value: 78,
    }, // 示例值
    {
      name: "广西壮族自治区",
      value: 29,
    }, // 示例值
    // {
    //   name: "西藏自治区",
    //   value: 56,
    // }, // 示例值
    {
      name: "宁夏回族自治区",
      value: 28,
    }, // 示例值
    {
      name: "新疆维吾尔自治区",
      value: 34,
    }, // 示例值
    {
      name: "香港特别行政区",
      value: 45,
    }, // 示例值
    {
      name: "澳门特别行政区",
      value: 67,
    }, // 示例值
  ];
  
  const provinceData = [
      {
        "data_id": 27,
        "name": "北京市",
        "value": "800000",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 28,
        "name": "山东省",
        "value": "90000000",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 29,
        "name": "河南省",
        "value": "10000000",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 30,
        "name": "河北省",
        "value": "8888288",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 31,
        "name": "海南省",
        "value": "222338",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 32,
        "name": "宁夏回族自治区",
        "value": "222344",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 33,
        "name": "青海省",
        "value": "898989",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      },
      {
        "data_id": 34,
        "name": "广西壮族自治区",
        "value": "100234",
        "lng": "",
        "lat": "",
        "count": 0,
        "quantities": 0,
        "degree": 0
      }
    // {"name":"四川","value":25763.31},
    // {"name":"天津","value":1388.14},
    // {"name":"宁夏","value":6602.91},
    // {"name":"安徽","value":21142.63},
    // {"name":"山东","value":22828.31},
    // {"name":"山西","value":15947.05},
    // {"name":"广东","value":29988.57},
    // {"name":"广西","value":18905.83},
    // {"name":"新疆","value":24253.71},
    // {"name":"江苏","value":17865.48},
    // {"name":"江西","value":14015.94},
    // {"name":"河北","value":19322.66},
    // {"name":"河南","value":23521.24},
    // {"name":"浙江","value":14671.2},
    // {"name":"海南","value":30902.14},
    // {"name":"湖北","value":21380.46},
    // {"name":"湖南","value":17120.72},
    // {"name":"甘肃","value":24401.84},
    // {"name":"福建","value":12516.06},
    // {"name":"贵州","value":10835.75},
    // {"name":"辽宁","value":19501.44},
    // {"name":"重庆","value":1112.34},
    // {"name":"陕西","value":13742.22},
    // {"name":"青海","value":14274.36},
    // {"name":"黑龙江","value":18293.65},
  ]
  const cityData = [
    {"name":"神农架","value":1229.76},
    {"name":"潜江","value":1259.47},
    {"name":"济源","value":1340.38},
    {"name":"新余","value":1226.53},
    {"name":"仙桃","value":1270.89},
    {"name":"天门","value":1264.74},
    {"name":"鹰潭","value":1289.64},
    {"name":"鄂州","value":1287.99},
    {"name":"张家界","value":1151.28},
    {"name":"雅安","value":1201.69},
    {"name":"景德镇","value":1308.12},
    {"name":"阿坝","value":1580},
    {"name":"湘西","value":1121.4},
    {"name":"自贡","value":1095.03},
    {"name":"随州","value":1282.89},
    {"name":"攀枝花","value":1754.38},
    {"name":"鹤壁","value":1307.23},
    {"name":"黄石","value":1269.49},
    {"name":"萍乡","value":1238.12},
    {"name":"漯河","value":1277.89},
    {"name":"咸宁","value":1256.15},
    {"name":"资阳","value":1121.66},
    {"name":"三门峡","value":1333.9},
    {"name":"甘孜","value":1739.73},
    {"name":"遂宁","value":1123.91},
    {"name":"巴中","value":1163.2},
    {"name":"广安","value":1108.13},
    {"name":"湘潭","value":1230.41},
    {"name":"内江","value":1106.13},
    {"name":"怀化","value":1170.11},
    {"name":"抚州","value":1272.74},
    {"name":"十堰","value":1278.1},
    {"name":"广元","value":1167.65},
    {"name":"乐山","value":1100.59},
    {"name":"眉山","value":1071.62},
    {"name":"郴州","value":1264.85},
    {"name":"娄底","value":1204.36},
    {"name":"益阳","value":1210.6},
    {"name":"株洲","value":1255.68},
    {"name":"荆门","value":1255.12},
    {"name":"恩施","value":1118},
    {"name":"孝感","value":1289.77},
    {"name":"泸州","value":1105.19},
    {"name":"德阳","value":1107.14},
    {"name":"吉安","value":1253.72},
    {"name":"永州","value":1241.57},
    {"name":"达州","value":1145.33},
    {"name":"宜宾","value":1078.4},
    {"name":"南充","value":1132.04},
    {"name":"焦作","value":1336.93},
    {"name":"宜昌","value":1204.34},
    {"name":"宜春","value":1240.4},
    {"name":"南昌","value":1294.42},
    {"name":"许昌","value":1294.77},
    {"name":"荆州","value":1251.2},
    {"name":"九江","value":1270.63},
    {"name":"襄阳","value":1254.34},
    {"name":"岳阳","value":1253.84},
    {"name":"平顶山","value":1283.26},
    {"name":"邵阳","value":1210.85},
    {"name":"衡阳","value":1239.31},
    {"name":"开封","value":1295.78},
    {"name":"绵阳","value":1163.66},
    {"name":"濮阳","value":1351.61},
    {"name":"上饶","value":1307.18},
    {"name":"凉山","value":1615.58},
    {"name":"黄冈","value":1312.85},
    {"name":"常德","value":1204.38},
    {"name":"洛阳","value":1306.53},
    {"name":"信阳","value":1271.35},
    {"name":"安阳","value":1336.7},
    {"name":"武汉","value":1295.36},
    {"name":"驻马店","value":1267.88},
    {"name":"新乡","value":1317.17},
    {"name":"长沙","value":1362.08},
    {"name":"周口","value":1281},
    {"name":"商丘","value":1328.64},
    {"name":"赣州","value":1314.44},
    {"name":"南阳","value":1274.05},
    {"name":"郑州","value":1316.17},
    {"name":"成都","value":1082.25},
    {"name":"重庆","value":1112.34},
    {"name":"铜陵","value":1291.5},
    {"name":"黄山","value":1289.68},
    {"name":"舟山","value":1349.71},
    {"name":"池州","value":1285.5},
    {"name":"淮北","value":1369.85},
    {"name":"马鞍山","value":1339.26},
    {"name":"三明","value":1333.04},
    {"name":"丽水","value":1326.27},
    {"name":"厦门","value":1455.06},
    {"name":"宁德","value":1350.86},
    {"name":"宣城","value":1309.48},
    {"name":"淮南","value":1341.04},
    {"name":"蚌埠","value":1359.57},
    {"name":"南平","value":1319.81},
    {"name":"衢州","value":1309.18},
    {"name":"龙岩","value":1371.85},
    {"name":"莆田","value":1424.14},
    {"name":"芜湖","value":1302.93},
    {"name":"安庆","value":1286.51},
    {"name":"镇江","value":1368.94},
    {"name":"湖州","value":1331.98},
    {"name":"滁州","value":1356.74},
    {"name":"六安","value":1304.41},
    {"name":"合肥","value":1313.49},
    {"name":"淮安","value":1377.63},
    {"name":"亳州","value":1324.12},
    {"name":"扬州","value":1379.27},
    {"name":"常州","value":1358.36},
    {"name":"宿迁","value":1377.78},
    {"name":"苏州","value":1377.13},
    {"name":"南京","value":1354.56},
    {"name":"温州","value":1337.51},
    {"name":"绍兴","value":1341.68},
    {"name":"嘉兴","value":1358.61},
    {"name":"福州","value":1378.17},
    {"name":"连云港","value":1414.51},
    {"name":"台州","value":1333.97},
    {"name":"泰州","value":1382.04},
    {"name":"无锡","value":1353.77},
    {"name":"金华","value":1328.16},
    {"name":"漳州","value":1456.94},
    {"name":"杭州","value":1316.49},
    {"name":"富阳","value":1291.42},
    {"name":"盐城","value":1394.32},
    {"name":"泉州","value":1426.19},
    {"name":"徐州","value":1384.61},
    {"name":"宁波","value":1337.64},
    {"name":"南通","value":1366.42},
    {"name":"苏州","value":1353.27},
    {"name":"上海","value":1361.79},
    {"name":"乌海","value":1683.32},
    {"name":"辛集","value":1317.17},
    {"name":"阳泉","value":1447.26},
    {"name":"雄安","value":1364.64},
    {"name":"定州","value":1364.64},
    {"name":"石嘴山","value":1673.46},
    {"name":"阿拉善","value":1751.24},
    {"name":"固原","value":1546.91},
    {"name":"朔州","value":1512.18},
    {"name":"晋城","value":1397.92},
    {"name":"吴忠","value":1695.02},
    {"name":"忻州","value":1476.99},
    {"name":"锡林郭勒","value":1583.55},
    {"name":"太原","value":1447.87},
    {"name":"大同","value":1504.52},
    {"name":"银川","value":1687.52},
    {"name":"包头","value":1617.29},
    {"name":"长治","value":1424.28},
    {"name":"兴安盟","value":1491.73},
    {"name":"乌兰察布","value":1592.51},
    {"name":"晋中","value":1444},
    {"name":"威海","value":1464.6},
    {"name":"东营","value":1439.55},
    {"name":"枣庄","value":1393.08},
    {"name":"吕梁","value":1482.56},
    {"name":"巴彦淖尔","value":1686.52},
    {"name":"呼和浩特","value":1568.78},
    {"name":"秦皇岛","value":1442.61},
    {"name":"临汾","value":1425.22},
    {"name":"承德","value":1466.87},
    {"name":"日照","value":1457.66},
    {"name":"呼伦贝尔","value":1383.76},
    {"name":"滨州","value":1420.82},
    {"name":"鄂尔多斯","value":1641.6},
    {"name":"通辽","value":1514.03},
    {"name":"张家口","value":1515.24},
    {"name":"泰安","value":1425.77},
    {"name":"淄博","value":1415.38},
    {"name":"赤峰","value":1574.89},
    {"name":"廊坊","value":1372.7},
    {"name":"衡水","value":1170.11},
    {"name":"运城","value":1384.25},
    {"name":"德州","value":1419.35},
    {"name":"聊城","value":1370.99},
    {"name":"烟台","value":1484.88},
    {"name":"济南","value":1406.93},
    {"name":"邢台","value":1362.42},
    {"name":"济宁","value":1414.51},
    {"name":"菏泽","value":1362.08},
    {"name":"邯郸","value":1362.95},
    {"name":"沧州","value":1435.68},
    {"name":"保定","value":1364.64},
    {"name":"唐山","value":1408.32},
    {"name":"青岛","value":1470.35},
    {"name":"天津","value":1388.14},
    {"name":"北京","value":1380.57},
    {"name":"石家庄","value":1374.67},
    {"name":"临沂","value":1428.11},
    {"name":"潍坊","value":1454.25},
    {"name":"大兴安岭","value":1250.81},
    {"name":"七台河","value":1294.46},
    {"name":"伊春","value":1260.31},
    {"name":"辽源","value":1341.59},
    {"name":"鹤岗","value":1279.62},
    {"name":"白山","value":1289.03},
    {"name":"本溪","value":1328.14},
    {"name":"双鸭山","value":1305.4},
    {"name":"鸡西","value":1301.66},
    {"name":"抚顺","value":1339.79},
    {"name":"黑河","value":1279.62},
    {"name":"盘锦","value":1401.34},
    {"name":"通化","value":1300.32},
    {"name":"辽阳","value":1375.38},
    {"name":"牡丹江","value":1287.45},
    {"name":"延边","value":1286.96},
    {"name":"丹东","value":1321.14},
    {"name":"佳木斯","value":1297.97},
    {"name":"四平","value":1387.49},
    {"name":"阜新","value":1437.89},
    {"name":"松原","value":1395.32},
    {"name":"铁岭","value":1373.8},
    {"name":"吉林","value":1280.8},
    {"name":"营口","value":1400.47},
    {"name":"白城","value":1460.49},
    {"name":"鞍山","value":1376.6},
    {"name":"葫芦岛","value":1448.86},
    {"name":"锦州","value":1420.42},
    {"name":"朝阳","value":1494.78},
    {"name":"齐齐哈尔","value":1367.52},
    {"name":"绥化","value":1314.55},
    {"name":"大庆","value":1372.79},
    {"name":"长春","value":1332.71},
    {"name":"沈阳","value":1380.65},
    {"name":"哈尔滨","value":1286.17},
    {"name":"大连","value":1402.18},
    {"name":"黄南","value":1762.46},
    {"name":"克拉玛依","value":1541.62},
    {"name":"果洛","value":1814.05},
    {"name":"嘉峪关","value":1768.42},
    {"name":"海北","value":1728.42},
    {"name":"金昌","value":1744.93},
    {"name":"铜川","value":1426.5},
    {"name":"甘南","value":1664.85},
    {"name":"海南","value":1816.11},
    {"name":"博尔塔拉","value":1530.03},
    {"name":"克孜勒苏柯尔克孜","value":1685.93},
    {"name":"玉树","value":1870.16},
    {"name":"安康","value":1239.44},
    {"name":"商洛","value":1331.26},
    {"name":"吐鲁番","value":1640.18},
    {"name":"海西","value":1883.2},
    {"name":"陇南","value":1345.13},
    {"name":"延安","value":1487.86},
    {"name":"阿勒泰","value":1527.49},
    {"name":"海东","value":1688.57},
    {"name":"平凉","value":1459.64},
    {"name":"中卫","value":1695.99},
    {"name":"白银","value":1660.9},
    {"name":"西宁","value":1711.39},
    {"name":"临夏","value":1626.16},
    {"name":"汉中","value":1212.52},
    {"name":"乌鲁木齐","value":1545.67},
    {"name":"哈密","value":1710.83},
    {"name":"天水","value":1438.29},
    {"name":"张掖","value":1727.01},
    {"name":"新疆生产建设兵团","value":1601.17},
    {"name":"武威","value":1728.28},
    {"name":"宝鸡","value":1343.54},
    {"name":"定西","value":1571.43},
    {"name":"酒泉","value":1794.22},
    {"name":"庆阳","value":1532.46},
    {"name":"兰州","value":1644.13},
    {"name":"塔城","value":1530.81},
    {"name":"和田","value":1780.65},
    {"name":"咸阳","value":1390.51},
    {"name":"渭南","value":1414.44},
    {"name":"巴音郭楞","value":1718.34},
    {"name":"伊犁","value":1531.07},
    {"name":"昌吉","value":1551.72},
    {"name":"榆林","value":1566.55},
    {"name":"阿克苏","value":1627.39},
    {"name":"西安","value":1329.6},
    {"name":"喀什","value":1730.81},
    {"name":"三沙","value":1719.96},
    {"name":"五指山","value":1642.17},
    {"name":"白沙","value":1627.56},
    {"name":"琼中","value":1578.99},
    {"name":"保亭","value":1669.13},
    {"name":"屯昌","value":1574.2},
    {"name":"昌江","value":1673.32},
    {"name":"定安","value":1562.42},
    {"name":"临高","value":1618.93},
    {"name":"东方","value":1681.01},
    {"name":"澄迈","value":1587.38},
    {"name":"怒江","value":1503.59},
    {"name":"琼海","value":1551.5},
    {"name":"乐东","value":1689.24},
    {"name":"陵水","value":1659.06},
    {"name":"万宁","value":1575.96},
    {"name":"三亚","value":1719.96},
    {"name":"迪庆","value":1633.15},
    {"name":"文昌","value":1563.24},
    {"name":"儋州","value":1632.52},
    {"name":"防城港","value":1394.72},
    {"name":"西双版纳","value":1684.77},
    {"name":"珠海","value":1443.69},
    {"name":"崇左","value":1385.89},
    {"name":"贺州","value":1300.74},
    {"name":"来宾","value":1313.92},
    {"name":"德宏","value":1648.89},
    {"name":"海口","value":1575.59},
    {"name":"六盘水","value":1285.5},
    {"name":"梧州","value":1371.21},
    {"name":"北海","value":1493.03},
    {"name":"河池","value":1251.66},
    {"name":"安顺","value":1209.19},
    {"name":"云浮","value":1402.31},
    {"name":"汕尾","value":1482.04},
    {"name":"丽江","value":1732.95},
    {"name":"柳州","value":1246.51},
    {"name":"韶关","value":1305.8},
    {"name":"阳江","value":1427.53},
    {"name":"黔东南","value":1131.22},
    {"name":"河源","value":1380.11},
    {"name":"黔西南","value":1306.56},
    {"name":"临沧","value":1692.94},
    {"name":"玉溪","value":1668.13},
    {"name":"中山","value":1434.7},
    {"name":"百色","value":1350.18},
    {"name":"铜仁","value":1073.4},
    {"name":"钦州","value":1416.71},
    {"name":"潮州","value":1495.48},
    {"name":"贵阳","value":1370.99},
    {"name":"文山","value":1470.64},
    {"name":"汕头","value":1523.29},
    {"name":"保山","value":1659.62},
    {"name":"黔南","value":1152.48},
    {"name":"肇庆","value":1370.12},
    {"name":"普洱","value":1696.47},
    {"name":"昭通","value":1275.77},
    {"name":"清远","value":1317.75},
    {"name":"楚雄","value":1715.56},
    {"name":"桂林","value":1237.42},
    {"name":"贵港","value":1353.34},
    {"name":"揭阳","value":1501.07},
    {"name":"红河","value":1595.77},
    {"name":"深圳","value":1456.8},
    {"name":"梅州","value":1434.95},
    {"name":"江门","value":1414.8},
    {"name":"惠州","value":1409.7},
    {"name":"昆明","value":1629.17},
    {"name":"毕节","value":1231.72},
    {"name":"遵义","value":1074.69},
    {"name":"佛山","value":1382.93},
    {"name":"玉林","value":1419.11},
    {"name":"大理","value":1722.45},
    {"name":"曲靖","value":1517.12},
    {"name":"茂名","value":1463.67},
    {"name":"南宁","value":1371.39},
    {"name":"湛江","value":1540.41},
    {"name":"东莞","value":1428.77},
    {"name":"广州","value":1372.65}
    ];
    
  const data = Array(22)
    .fill()
    .map((_, i) => {
      const y = i % 6;
      
      let geojson = {}
    const flag = Math.random() > 0.5 ? '省': '市';
    if (flag === '省') {
      geojson = provinceData;
    } else {
      geojson = cityData;
    }

      return {
        id: Random.id(),
        task_code: Random.id(),
        file_id: Random.id(),
        file_name: y === 4 ? "全国地图热力图"+ Random.ctitle() +  "-" + flag : Random.ctitle(),
        file_path: "./file_upload/信息统计.xlsx",
        x_title: "月份",
        y_title: "百分比",
        create_time: Random.datetime(),
        chart_type: type[y],
        is_default: i < 6 ? 1 : 0,
        data:
          y === 5
            ? Array(1)
                .fill()
                .map(() => {
                  let res = Mock.mock({
                    "data|50-1000": [
                      {
                        // 属性 id 是一个自增数，起始值为 1，每次增 1
                        // 'number|+1': 1,
                        "data_id|+1": 10,
                        "lng|75-130.3-6": 76,
                        "lat|25-50.3-6": 26,
                        "count|1-1000": 10,
                        "degree|1-1000": 100,
                        "quantities|1-1000": 100,
                        "name": '',
                        "value": '',
                      },
                    ],
                  });
                  return res.data;
                })[0]
            : (y === 4 ? 
                geojson : Array(7)
                .fill()
                .map(() => {
                  return {
                    data_id: Random.id(),
                    value: Math.random().toFixed(2),
                    name: Random.cword(),
                  };
                })),
      };
    });
  ctx.body = {
    ...msg,
    data,
    total: 200,
  };
});

// 一人一档-文件上传
router.all("/carbon/api/file/upload", async (ctx, next) => {
  await sleep(2000);
  ctx.body = { ...msg, data: {} };
});

// 国家数据面板
router.all("/carbon/api/country/gdp/chart", async (ctx, next) => {
  await sleep(2000);
  const filePath = path.join(__dirname,'../mock/newtable.json');
  const rawData = fs.readFileSync(filePath, 'utf8');
  const jsonData = JSON.parse(rawData);
  ctx.body = { ...msg, data: jsonData };
});
// 金融数据面板
router.all("/carbon/api/country/country/chart", async (ctx, next) => {
  await sleep(2000);
  const filePath = path.join(__dirname,'../mock/national-data.json');
  const rawData = fs.readFileSync(filePath, 'utf8');
  const jsonData = JSON.parse(rawData);
  ctx.body = { ...msg, data: jsonData };
});
module.exports = router;
